package testenv.model.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import testenv.model.AbstractBaseEntity;


@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name="child_id_seq", sequenceName="child_id_sequence")
public class Child extends AbstractBaseEntity {
	private static final long serialVersionUID = 1L;

	@ManyToOne
	private Parent parent = null;
	
	private String name = null;

	private Integer age = null;

	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="child_id_seq")
	@GenericGenerator(
	     name="child_id_seq",
	     strategy="sequence",
	     parameters= {
	         @Parameter(name="minvalue", value="1"),
	         @Parameter(name="increment", value="1"),
	         @Parameter(name="sequence", value="child_id_sequence")
	         })
	private Integer id = null;
	
	
	public Child() {
	}

	public Child(String name, Integer age, Parent parent) {
		this.name = name;
		this.age = age;
		this.parent = parent;
	}

	
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	public Parent getParent() {
		return parent;
	}

	public void setParent(Parent parent) {
		this.parent = parent;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}
	
	
}
